package ffmvc.model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

public class ManagerPerformanceExtractor implements ResultSetExtractor<ManagerPerformance> {
	@Override
	public ManagerPerformance extractData(ResultSet rs) throws SQLException, DataAccessException {
		ManagerPerformance perf = new ManagerPerformance();
		perf.setId(rs.getString(1));
		perf.setManagerId(rs.getString(2));
		String sArray = rs.getString(3);
		perf.setPickedTeam(Arrays.asList(sArray));
		perf.setFormation(rs.getString(4));
		perf.setTotalPoints(rs.getDouble(5));
		perf.setCaptainId(rs.getString(6));
		perf.setWeek(rs.getInt(7));
		perf.setSeason(rs.getInt(8));
		return perf;
	}
}
